﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Facebook.Schema;
using CityLife.CityService;

namespace CityLife
{
	public partial class Road1I : UserControl, ICityDesign,INeighbour
	{
        public Road1I()
		{
			// Required to initialize variables
			InitializeComponent();
            this.SetValue(Canvas.ZIndexProperty, ElementZindex.Road);
            SignPos.Visibility = Visibility.Collapsed;

            //SetNeighbour();


		}

       public void SetNeighbour()
        {
            ICityElement element = Parent as ICityElement;
           if(element!=null)
            if (element.ConnectionID > 0)
            {


                //get the uri
                Neighbour u = MainPage.Heart.City.Neighboures[element.ConnectionID];

                Image thumbnail = new Image();
                Uri uri = new Uri(u.Facebook_pic_square, UriKind.Absolute);
                ImageSource img = new System.Windows.Media.Imaging.BitmapImage(uri);
                SignPos.Thumb.SetValue(Image.SourceProperty, img);
                SignPos.UserName.Text = u.Name;
                SignPos.Visibility = Visibility.Visible;

            }
            else
            {
                SignPos.Visibility = Visibility.Collapsed;
            }

        }




        #region ICityDesign Members


        public CursorType CursorType
        {
            get { return CursorType.Single; }
        }

     


        public ShopInfo Info
        {
            get
            {
                ShopInfo info = new ShopInfo();
                info.DesignType = this.GetType();
                info.Name = " Simple road";
                info.Cost = 1;
                info.BuildDuration = 30;
                info.RepairDuration = 30;
                info.MaxAge = 15;
                info.XP = 50;
                info.Thumbnail = new Uri(Application.Current.Host.Source.AbsoluteUri.Replace(Application.Current.Host.Source.LocalPath, "") + "/images/ToolThumbs/R1D1.png", UriKind.Absolute).ToString();
                info.ElementType = CityLife.CityService.CityElementType.Road;
                return info;
            }
        }

        public void SetBuildStep(CityElementStage step)
        {

        }
        #endregion
    }
}